﻿using System;
using Token.Piker.BLL;

namespace Token.Piker.Web.Admin.NewsAlbum
{
    public partial class Show : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
            {
                string strid = Request.Params["id"];
                int ID = (Convert.ToInt32(strid));
                ShowInfo(ID);
                anchorAddPhoto.HRef = "AddPhoto.aspx?ID=" + ID;
                anchorShowPhoto.HRef = "ShowPhoto.aspx?ID="+ID;
            }
        }

        private void ShowInfo(int ID)
        {
            Token.Piker.BLL.NewsAlbumBLL bll = new Token.Piker.BLL.NewsAlbumBLL();
            Token.Piker.Model.NewsAlbum model = bll.GetModel(ID);
            this.lblID.Text = model.ID.ToString();
            this.lblAlbumName.Text = model.AlbumName;
            this.lblDescrip.Text = model.Descrip;
            this.lblCreator.Text = GetAdminRealName((int)model.Creator) ;
            this.lblCreateTime.Text = model.CreateTime.ToString();
            this.lblShotTime.Text = model.ShotTime.ToString();
            this.lblShotPosition.Text = model.ShotPosition;
            this.lblFlag.Text = model.Flag.ToString()=="0" ? "正常" : "删除";
        }
        private string GetAdminRealName(int id)
        {
            AdminBLL adminBLL = new AdminBLL();
            Token.Piker.Model.Admin admin = adminBLL.GetModel(id);
            return admin.RealName;
        }
    }
}